SlkStore.GetNewAssignmentDefaultProperties Method

Returns an AssignmentProperties object populated with default information for a new assignment based on a given e-learning package or non-e-learning document. This method doesn't actually create the assignment -- it just returns information that can be used as defaults for a form that a user would fill in to create a new assignment.

Parent Type: SlkStore

Namespace: Microsoft.SharePointLearningKit

Assembly: Microsoft.SharePointLearningKit.dll

Syntax
C#

public AssignmentProperties GetNewAssignmentDefaultProperties (
SPWeb destinationSPWeb,
string location,
Nullable<int> organizationIndex,
SlkRole slkRole,
out LearningStoreXml packageWarnings

)

Parameters

destinationSPWeb

The SPWeb that the assignment would be assigned in.

location

The MLC SharePoint location string that refers to the e-learning package or non-e-learning document that would be assigned. Use SharePointPackageStore.GetLocation to construct this string.

organizationIndex

The zero-based index of the organization within the e-learning content to assign; this is the value that's used as an index to ManifestReader.Organizations. If the content being assigned is a non-e-learning document, use null for organizationIndex.

slkRole

The SlkRole for which information is to be retrieved. Use SlkRole.Learner to get default information for a self-assigned assignment, i.e. an assignment with no instructors for which the current learner is the only learner. Otherwise, use SlkRole.Instructor.

packageWarnings

Where returned package-related warnings are stored. This XML consists of a root "<Warnings>" element containing one "<Warning>" element per warning, each of which contains the text of the warning as the content of the element plus the following attributes: the "Code" attribute contains the warning's ValidationResultCode, and the "Type" attribute contains the warning's type, either "Error" or "Warning". packageWarnings is set to null if there are no warnings.

Exceptions
Exception type Condition
FileNotFoundException

location refers to a file that does not exist.

InvalidOperationException

destinationSPWeb is not in the SPSite that this SlkStore is associated with.

SafeToDisplayException

An error occurred that can be displayed to a browser user. Possible cause: the package has problems severe enough to prevent it from being assignable within SharePoint Learning Kit.

UnauthorizedAccessException

location refers to a file that the user does not have access to, or the user is not a Reader on destinationSPWeb

NotAnInstructorException

The user is not an instructor on destinationSPWeb and the assignment is not self-assigned.

Remarks

If slkRole is SlkRole.Learner, default properties for a self-assigned assignment are returned. In this case, the returned AssignmentProperties will contain no users in AssignmentProperties.Instructors, and AssignmentProperties.Learners will contain only the current user.

Security:  If slkRole is SlkRole.Instructor, this operation fails if the current user doesn't have SLK instructor permissions on destinationSPWeb. Also fails if the current user doesn't have access to the package/file.